package net.app.zoneland.common.core.constant;

/**
 * @Description
 * @Author LENOVO
 * @CreateTime 2020/12/20 12:09
 * @Version: 1.0
 */
public interface AuthConstants {

    /**
     * JWT存储权限前缀
     */
    String AUTHORITY_PREFIX = "ROLE_";

    /**
     * JWT存储权限属性
     */
    String AUTHORITY_CLAIM_NAME = "authorities";

    /**
     * 认证信息Http请求头
     */
    String JWT_TOKEN_HEADER = "Authorization";

    /**
     * JWT令牌前缀
     */
    String JWT_TOKEN_PREFIX = "Bearer ";

    /**
     * JWT载体key
     */
    String JWT_PAYLOAD_KEY = "payload";

    /**
     * Redis缓存权限规则key
     */
    String RESOURCE_ROLES_KEY = "auth:resourceRoles";

    /**
     * 黑名单token前缀
     */
    String TOKEN_BLACKLIST_PREFIX = "auth:token:blacklist:";

    /**
     * 客户端查询字段CONCAT('{noop}',client_secret) as
     */
    String CLIENT_DETAILS_FIELDS = "client_id, client_secret, resource_ids, scope, "
            + "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, "
            + "refresh_token_validity, additional_information, autoapprove";

    /**
     * 查询客户端
     */
    String BASE_CLIENT_DETAILS_SQL = "select " + CLIENT_DETAILS_FIELDS + " from oauth_client_details";

    /**
     * 按客户端ID排序
     */
    String FIND_CLIENT_DETAILS_SQL = BASE_CLIENT_DETAILS_SQL + " order by client_id";

    /**
     * 根据客户端ID查询
     */
    String SELECT_CLIENT_DETAILS_SQL = BASE_CLIENT_DETAILS_SQL + " where client_id = ?";

    String JWT_USER_ID_KEY = "id";

    String JWT_CLIENT_ID_KEY = "client_id";

    /**
     * 商城后台管理客户端ID
     */
    String ADMIN_CLIENT_ID="youlai-mall-admin";

    /**
     * 后台管理接口路径匹配
     */
    String ADMIN_URL_PATTERN ="/user/**" ;

    /**
     * jwt的文件
     */
    String JWT_RESOURCE_NAME="oauth2.jks";

    /**
     * jwt密码
     */
    String JWT_PUBLIC_KEY="oauth2";
}
